<template>
  <div class="about">
    <el-row>
      <el-col :span="5">
        <el-input
          placeholder="请输入姓名"
          v-model="likename"
          clearable>
        </el-input>
      </el-col>
      <el-col :span="5">
        <el-button @click="add(dm=false)" type="primary">添加档案</el-button>
      </el-col>
    </el-row>
    <template>
      <el-table
        :data="findUsers(likename).slice((pageNun-1)*pageSize,pageNun*pageSize)"
        border
        style="width: 100%">
        <el-table-column
          prop="filenumber"
          label="会员编号">
        </el-table-column>
        <el-table-column
          prop="name"
          label="姓名">
        </el-table-column>
        <el-table-column>
          <template slot-scope="scope">
            <el-switch
              v-model="scope.row.tMemberInfo.status==0"
              active-text="开启"
              inactive-text="禁用"
            @change="ups(scope.row)">
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column
          prop="phonenumber"
          label="手机号码">
        </el-table-column>
        <el-table-column
          prop="sex"
          label="性别">
          <template slot-scope="scope">
            <el-steps v-if="scope.row.sex==1">男</el-steps>
            <el-steps v-if="scope.row.sex==2">女</el-steps>
          </template>
        </el-table-column>
        <el-table-column prop="" label="注册时间" header-align="center" align="center">
          <template slot-scope="scope">
            {{scope.row.regtime | dateFormat}}
          </template>
        </el-table-column>
        <el-table-column
          label="操作">
          <template slot-scope="scope">
            <el-button  type="text" size="small" @click="up(scope.row)">编辑</el-button>
            <el-button type="text" size="small" @click="ck(scope.row)">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @size-change="handleSizeChange"
        :current-page.sync="pageNun"
        :page-sizes="[2,4,6]"
        :page-size='pageSize'
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </template>


    <el-dialog width="100p"  custom-class="custom-dialog"
               :visible.sync="dm" :close-on-click-modal="false">
      <h3>{{cx}}</h3>
      <el-form  label-width="100px" class="demo-dynamic" :rules="rules" :model="archives" ref="ArForm">
      <el-tabs type="border-card">
        <el-tab-pane label="个人信息">
            <el-form-item label="会员编号:">
              <el-input  v-model="archives.tMember.filenumber" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="会员姓名:" prop="name">
              <el-input v-model="archives.tMember.name"></el-input>
            </el-form-item>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="性别:" prop="sex">
                  <el-radio-group v-model="archives.tMember.sex">
                    <el-radio label="1">男</el-radio>
                    <el-radio label="2">女</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="健康师:" prop="healthMgrId">
                <el-select v-model="archives.from.healthMgrId" placeholder="请选择">
                <el-option
                  v-for="item in List"
                  :key="item.healthMgrId"
                  :label="item.healthMgrName"
                  :value="item.healthMgrId">
                </el-option>
              </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="预约套餐:" prop="setmealId">
                <el-select v-model="archives.fromyy.setmealId" placeholder="请选择">
                <el-option
                  v-for="item in Listts"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id">
                </el-option>
              </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="预约类型:" prop="ordertype">
                <el-select v-model="archives.fromyy.ordertype" placeholder="请选择">
                <el-option label="微信预约" value="微信预约"></el-option>
                <el-option label="电话预约" value="电话预约"></el-option>
                <el-option label="医院预约" value="医院预约"></el-option>
              </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="出生日期:" prop="birthday">
                <el-date-picker
                v-model="archives.tMember.birthday"
                type="date"
                placeholder="选择日期">
              </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="电话:" prop="phonenumber">
                  <el-input v-model="archives.tMember.phonenumber"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="邮箱:" prop="email">
                  <el-input v-model="archives.tMember.email"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="会员密码:" prop="password">
                <el-input v-model="archives.tMember.password"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="职业:">
                <el-input v-model="archives.from.job"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="年龄:" prop="age">
                <el-input v-model="archives.tMember.age"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="文化程度:">
                <el-input v-model="archives.from.educationDegree"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="身份证号:" prop="idcard">
                  <el-input v-model="archives.tMember.idcard"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="祖籍:">
                  <el-input v-model="archives.from.nativePlace"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="备注:">
              <el-input v-model="archives.tMember.remark"></el-input>
            </el-form-item>
        </el-tab-pane>
        <el-tab-pane label="身体状况">
          <el-row :gutter="50">
            <el-col :span="12">
              <el-form-item label="身高/CM">
              <el-input-number v-model="archives.fromx.height" controls-position="right" @change="handleChange" :min="1"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="体重/G">
              <el-input-number v-model="archives.fromx.weight" controls-position="right" @change="handleChange" :min="1"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="舒展压">
              <el-input-number v-model="archives.fromx.dbp" controls-position="right" @change="handleChange" :min="1"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="收缩压">
              <el-input-number v-model="archives.fromx.sbp" controls-position="right" @change="handleChange" :min="1"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="腰围/CM">
              <el-input-number v-model="archives.fromx.waistline" controls-position="right" @change="handleChange" :min="1"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="臀围/CM">
              <el-input-number v-model="archives.fromx.hipline" controls-position="right" @change="handleChange" :min="1"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="呼吸频率">
              <el-input-number v-model="archives.fromx.breth" controls-position="right" @change="handleChange" :min="1"></el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="体温/°C">
              <el-input-number v-model="archives.fromx.thermometer" :precision="2" controls-position="right" @change="handleChange" :min="1"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="病例纪录">
          <el-form-item label="既往史:">
          <el-input v-model="archives.fromc.previousHistory"></el-input>
          </el-form-item>
          <!--{{dearDiseaseHas}}
          {{myDiseaseHas}}-->
          <el-form-item label="家族史:">
          <!--<el-input v-model="archives.fromc.familyHistory"></el-input>-->
            <el-checkbox-group v-model="dearDiseaseHas">
              <el-checkbox v-for="item in dearDisease" :label="item.id" :key="item.id" >{{item.name}}</el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="病史:">
          <!--<el-input v-model="archives.fromc.medicalHistory"></el-input>-->
            <el-checkbox-group v-model="myDiseaseHas">
              <el-checkbox v-for="item in myDisease" :label="item.id" :key="item.id" >{{item.name}}</el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="过敏史:">
          <el-input v-model="archives.fromc.allergicHistory"></el-input>
          </el-form-item>
          <el-form-item label="慢性病:">
          <el-input v-model="archives.fromc.chronicDisease"></el-input>
          </el-form-item>
        </el-tab-pane>
      </el-tabs>
      </el-form>
      <el-button  v-show="xx!=null" @click="adds()" type="primary">确认</el-button>
      <el-button v-show="xx!=null" @click="dm=false" type="danger">取消</el-button>
    </el-dialog>
  </div>
</template>

<script>
import { queryAllTDisease,queryDiseaseByMember,updateDiseaseById } from '@/api/xsf/diseaseLibrary'

  import  {tMemberLis,tHealthmgrList,tMemberDynamicinfo,tMembermedicalhistory,archiveadd,archiveup,tOrder,tSetmealLists,tMemberInfoup} from '@/api/lgx/archives'
    export default {
      data() {
        return {
          //疾病信息
          myDisease:[],
          dearDisease:[],
          myDiseaseHas:[],
          dearDiseaseHas:[],
          rules:{
            name: [
              {required: true, validator:(a,b,c)=>{
                if(this.archives.tMember.name==""){
                  c(new Error("姓名不能为空"))
                }else {
                  c()
                }
                }, trigger: 'blur' }
            ],
            sex:[{required: true,validator:(a,b,c)=>{
              if(this.archives.tMember.sex==""){
                  c(new Error("请选择性别"))
              }else {
                c()
              }
              },trigger: 'blur'}
              ],
            healthMgrId:[{required: true,validator:(a,b,c)=>{
                if(this.archives.from.healthMgrId==""){
                  c(new Error("请选择健康师"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ],
            setmealId:[{required: true,validator:(a,b,c)=>{
                if(this.archives.fromyy.setmealId==""){
                  c(new Error("请选择套餐"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ],
            ordertype:[{required: true,validator:(a,b,c)=>{
                if(this.archives.fromyy.ordertype==""){
                  c(new Error("请选择套餐"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ],
            birthday:[{required: true,validator:(a,b,c)=>{
                if(this.archives.tMember.birthday==""){
                  c(new Error("请选择出生日期"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ],
            phonenumber:[{required: true,validator:(a,b,c)=>{
                if(this.archives.tMember.phonenumber==""){
                  c(new Error("电话号不能为空"))
                }else if(!(/^1\d{10}$/.test(this.archives.tMember.phonenumber))){
                  c(new Error("电话号格式有误"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ],
            email:[{required: true,validator:(a,b,c)=>{
                if(this.archives.tMember.email==""){
                  c(new Error("邮箱不能为空"))
                }else if(!(/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.archives.tMember.email))){
                  c(new Error("邮箱格式有误"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ],
            password:[{required: true,validator:(a,b,c)=>{
                if(this.archives.tMember.password==""){
                  c(new Error("请设置会员密码"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ],
            age:[{required: true,validator:(a,b,c)=>{
                if(this.archives.tMember.age==""){
                  c(new Error("年龄不能为空"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ],
            idcard:[{required: true,validator:(a,b,c)=>{
              if(this.cx!="修改档案"){
                for(let i=0;i<this.routerList.length;i++){
                  if(this.routerList[i].idcard==this.archives.tMember.idcard){
                    c(new Error("身份证号已存在"))
                  }
                }
              }
                if(this.archives.tMember.idcard==""){
                  c(new Error("身份证不能为空"))
                }else if(!(/(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(this.archives.tMember.idcard))){
                  c(new Error("身份证格式有误"))
                }else {
                  c()
                }
              },trigger: 'blur'}
            ]
          },
          dm:false,
          cx:"",
          xx:null,
          likename:"",
          pageSize: 4,
          pageNun: 1,
          total:5,
          routerList: [],
          List:[],
          Listts:[],
        archives:{
          //会员信息
          tMember:{
            id:"",
            filenumber:"",
            name:"",
            age:"",
            sex:"",
            idcard:"",
            phonenumber:"",
            password:"",
            regtime:"",
            email:"",
            birthday:"",
            remark:"",
            createtime:"",
            updatetime:""
          },
          //会员详情
          from:{
            id:"",
            tMemberId:"",
            educationDegree:"",
            nativePlace:"",
            job:"",
            healthMgrId:"",
            status:"",
            createtime:"",
            updatetime:"",
            maritalStatus:0
          },
          //会员动态信息
          fromx:{
            id:"",
            tMemberId:"",
            height:"",
            weight:"",
            dbp:"",
            sbp:"",
            breth:"",
            thermometer:"",
            waistline:"",
            hipline:"",
            createtime:"",
            updatetime:""
          },
          //会员病历详情
          fromc:{
            id:"",
            tMemberId:"",
            previousHistory:"",
            familyHistory:"",
            allergicHistory:"",
            medicalHistory:"",
            chronicDisease:"",
            createtime:"",
            updatetime:""
          }
          ,
          fromyy:{
            id:"",
            memberId:"",
            orderdate:"",
            ordertype:"",
            orderstatus:"",
            setmealId:"",
            createtime:"",
            updatetime:""
          }
        },
          fromxq:{
            id:"",
            tMemberId:"",
            maritalStatus:"",
            ob:"",
            educationDegree:"",
            nativePlace:"",
            healthMgrId:"",
            status:"",
            createtime:"",
            updatetime:""
          },

        }

      }, methods: {
        handleSizeChange(val) {
          this.pageSize = val
        },findUsers(likename){
          //包含includes的意思
          return this.routerList.filter((item,i)=>{
            if(item.name.includes(likename)){
              return item;
            }
          });
        },
        //查看会员信息
        ck(row){
          this.archives.tMember.id=row.id;
          this.archives.tMember.filenumber=row.filenumber;
          this.archives.tMember.sex=row.sex;
          this.archives.tMember.name=row.name;
          this.archives.tMember.email=row.email;
          this.archives.tMember.idcard=row.idcard;
          this.archives.tMember.age=row.age;
          this.archives.tMember.password=row.password
          this.archives.tMember.phonenumber=row.phonenumber;
          this.archives.tMember.regtime=row.regtime;
          this.archives.tMember.remark=row.remark;
          this.archives.tMember.createtime=row.createtime;
          this.archives.tMember.updatetime=row.updatetime;
          this.archives.tMember.birthday=row.birthday;
          this.archives.from.id=row.tMemberInfo.id;
          this.archives.from.tMemberId=row.tMemberInfo.tMemberId;
          this.archives.from.nativePlace=row.tMemberInfo.nativePlace
          this.archives.from.job=row.tMemberInfo.job;
          this.archives.from.educationDegree=row.tMemberInfo.educationDegree;
          this.archives.from.healthMgrId=row.tMemberInfo.healthMgrId
          this.archives.from.status=row.tMemberInfo.status
          this.archives.from.createtime=row.tMemberInfo.createtime
          this.archives.from.updatetime=row.tMemberInfo.updatetime
          this.archives.from.maritalStatus=row.tMemberInfo.maritalStatus
          this.dm=true
          this.cx="查看档案"
          this.xx=null
            if(this.archives.tMember.id!=null){
              this.st(this.archives.tMember.id)
            }
            if(this.archives.tMember.id!=null){
              this.bl(this.archives.tMember.id)
            }
          if(this.archives.tMember.id!=null){
            this.yy(this.archives.tMember.id)
          }
          if(this.archives.tMember.id!=null){
            this.queryDiseaseByMember(this.archives.tMember.id)
          }
        },
        //通过member查询疾病
        queryDiseaseByMember(id){
            queryDiseaseByMember(id).then((response)=>{
              var myDiseases=response.data;
              //this.$set(this.dearDiseaseHas,[]);
              //this.$set(this.myDiseaseHas,[]);
              this.myDiseaseHas=[];
              this.dearDiseaseHas=[];
              for(var i=0;i<myDiseases.length;i++){
                if(myDiseases[i].who==0){
                    this.myDiseaseHas.push(myDiseases[i].diseaseLibraryLib);
                }else if(myDiseases[i].who==1){
                    this.dearDiseaseHas.push(myDiseases[i].diseaseLibraryLib);
                }
              }
              //this.$set(this.myDiseaseHas,this.myDiseaseHas);
              //this.$set(this.dearDiseaseHas,this.dearDiseaseHas);

            })
        },
        //身体详情
        st(id){
          tMemberDynamicinfo(id).then(response=>{
              this.archives.fromx.id=response.data.id
              this.archives.fromx.tMemberId=response.data.tMemberId
              this.archives.fromx.height=response.data.height
              this.archives.fromx.weight=response.data.weight
              this.archives.fromx.dbp=response.data.dbp
              this.archives.fromx.sbp=response.data.sbp
              this.archives.fromx.breth=response.data.breth
              this.archives.fromx.thermometer=response.data.thermometer
              this.archives.fromx.waistline=response.data.waistline
              this.archives.fromx.hipline=response.data.hipline
          })
        },
        //病历详情
        bl(id){
          tMembermedicalhistory(id).then(response=>{
            this.archives.fromc.id=response.data.id;
              this.archives.fromc.tMemberId=response.data.tMemberId
              this.archives.fromc.previousHistory=response.data.previousHistory
              this.archives.fromc.familyHistory=response.data.familyHistory
              this.archives.fromc.allergicHistory=response.data.allergicHistory
              this.archives.fromc.medicalHistory=response.data.medicalHistory
              this.archives.fromc.chronicDisease=response.data.chronicDisease
              this.archives.fromc.createtime=response.data.createtime
              this.archives.fromc.updatetime=response.data.updatetime

          })
        },
        // 修改点击
        up(row){
          this.archives.tMember.id=row.id;
          this.archives.tMember.filenumber=row.filenumber;
          this.archives.tMember.sex=row.sex;
          this.archives.tMember.name=row.name;
          this.archives.tMember.email=row.email;
          this.archives.tMember.idcard=row.idcard;
          this.archives.tMember.age=row.age;
          this.archives.tMember.password=row.password
          this.archives.tMember.phonenumber=row.phonenumber;
          this.archives.tMember.regtime=row.regtime;
          this.archives.tMember.remark=row.remark;
          this.archives.tMember.createtime=row.createtime;
          this.archives.tMember.updatetime=row.updatetime;
          this.archives.tMember.birthday=row.birthday;
          this.archives.from.id=row.tMemberInfo.id;
          this.archives.from.tMemberId=row.tMemberInfo.tMemberId;
          this.archives.from.nativePlace=row.tMemberInfo.nativePlace
          this.archives.from.job=row.tMemberInfo.job;
          this.archives.from.educationDegree=row.tMemberInfo.educationDegree;
          this.archives.from.healthMgrId=row.tMemberInfo.healthMgrId
          this.archives.from.status=row.tMemberInfo.status
          this.archives.from.createtime=row.tMemberInfo.createtime
          this.archives.from.updatetime=row.tMemberInfo.updatetime
          this.archives.from.maritalStatus=row.tMemberInfo.maritalStatus
          this.dm=true
          this.cx="修改档案"
          this.xx=1
          if(this.archives.tMember.id!=null){
            this.st(this.archives.tMember.id)
          }
          if(this.archives.tMember.id!=null){
            this.bl(this.archives.tMember.id)
          }
          if(this.archives.tMember.id!=null){
            this.yy(this.archives.tMember.id)
          }
          if(this.archives.tMember.id!=null){
            this.queryDiseaseByMember(this.archives.tMember.id)
          }
        },
        add(){
          this.dm=true
          this.xx=1
          this.cx="添加档案"
          this.archives.tMember.id=""
          this.archives.tMember.filenumber=this.getProjectNum() + Math.floor(Math.random() * 1000);
          this.archives.tMember.sex=""
          this.archives.tMember.name=""
          this.archives.tMember.email=""
          this.archives.tMember.idcard=""
          this.archives.tMember.password=""
          this.archives.tMember.phonenumber=""
          this.archives.tMember.birthday=""
          this.archives.tMember.age=""
          this.archives.tMember.remark=""
          this.archives.from.id=""
          this.archives.from.tMemberId=""
          this.archives.from.nativePlace=""
          this.archives.from.job=""
          this.archives.from.educationDegree=""
          this.archives.from.healthMgrId=""
          this.archives.fromx.id=""
          this.archives.fromx.tMemberId=""
          this.archives.fromx.height=""
          this.archives.fromx.weight=""
          this.archives.fromx.dbp=""
          this.archives.fromx.sbp=""
          this.archives.fromx.breth=""
          this.archives.fromx.thermometer=""
          this.archives.fromx.waistline=""
          this.archives.fromx.hipline=""
          this.archives.fromc.id=""
          this.archives.fromc.tMemberId=""
          this.archives.fromc.previousHistory=""
          this.archives.fromc.familyHistory=""
          this.archives.fromc.allergicHistory=""
          this.archives.fromc.medicalHistory=""
          this.archives.fromc.chronicDisease=""
          this.archives.fromc.createtime=""
          this.archives.fromc.updatetime=""
          this.archives.fromyy.setmealId=""
          this.archives.fromyy.id=""
          this.archives.from.maritalStatus=0;
        },
        //修改和添加
        adds(){
          this.$refs['ArForm'].validate(valid => {
            if (valid) {
              this.dm=false
              if(this.archives.tMember.id==""){
                archiveadd(this.archives,this.myDiseaseHas,this.dearDiseaseHas).then(response=> {
                  if(response.data==1){
                    this.$message({
                      message: '添加成功!',
                      type: 'success'
                    });
                    this.xs();
                  }
                })
              }else{


                    archiveup(this.archives).then(response=>{
                       updateDiseaseById(this.archives.tMember.id,this.myDiseaseHas,this.dearDiseaseHas).then(()=>{

                         if(response.data==1){
                           this.$message({
                             message: '修改成功!',
                             type: 'success'
                           });
                           this.xs();
                         }
                        })
                    })



              }
            } else {
              this.$message.error('请填完所要填完的信息');
            }
          })

        },
        yy(id){
          tOrder(id).then(response=>{
              this.archives.fromyy.id=response.data.id
              this.archives.fromyy.memberId=response.data.memberId
              this.archives.fromyy.orderdate=response.data.orderdate
              this.archives.fromyy.ordertype=response.data.ordertype
              this.archives.fromyy.orderstatus=response.data.orderstatus
              this.archives.fromyy.createtime=response.data.createtime
              this.archives.fromyy.setmealId=response.data.setmealId

          })
        },
        ups(row){
          this.fromxq.id=row.tMemberInfo.id;
          this.fromxq.tMemberId=row.tMemberInfo.tMemberId;
          this.fromxq.nativePlace=row.tMemberInfo.nativePlace
          this.fromxq.job=row.tMemberInfo.job;
          this.fromxq.educationDegree=row.tMemberInfo.educationDegree;
          this.fromxq.healthMgrId=row.tMemberInfo.healthMgrId
          if(row.tMemberInfo.status==0){
            this.fromxq.status=1
          }
          if(row.tMemberInfo.status==1){
            this.fromxq.status=0
          }
          this.fromxq.createtime=row.tMemberInfo.createtime
          this.fromxq.updatetime=row.tMemberInfo.updatetime
          this.fromxq.maritalStatus=row.tMemberInfo.maritalStatus
          tMemberInfoup(this.fromxq).then(response=>{
           if(response.data==1){
             this.$message({
               message: '已经更改',
               type: 'success'
             });
             this.xs();
           }
          })
        },
        xs(){
          tMemberLis().then(response=>{
            this.routerList=response.data;
            this.total=response.data.length
          })
        },
          //获取当前日期的方法
         getProjectNum () {
          const projectTime = new Date() // 当前中国标准时间
          const Year = projectTime.getFullYear() // 获取当前年份 支持IE和火狐浏览器.
          const Month = projectTime.getMonth() + 1 // 获取中国区月份
          const Day = projectTime.getDate() // 获取几号
          var CurrentDate = Year
          if (Month >= 10) { // 判断月份和几号是否大于10或者小于10
           CurrentDate += Month
          } else {
           CurrentDate += '0' + Month
          }
          if (Day >= 10) {
            CurrentDate += Day
          } else {
            CurrentDate += '0' + Day
          }
          return CurrentDate
        },
        handleChange(value) {
        },
        //初始化疾病信息
        initDisease(){
          queryAllTDisease().then((response)=>{
              this.myDisease=response.data;
              this.dearDisease=response.data;
          })
        }
      },created() {
        //显示所有
        tMemberLis().then(response=>{
          console.log(response.data)
          this.routerList=response.data;
          this.total=response.data.length
        }),
          //健康师显示
          tHealthmgrList().then(response=>{
            this.List=response.data
          }),
          //套餐显示
          tSetmealLists().then(response=>{
            this.Listts=response.data
          })
          this.initDisease();
      },
      //时间显示
      filters:{
        dateFormat:function(data){
          var dt=new Date(data)
          var n=dt.getFullYear();
          var y=(dt.getMonth()+1).toString().padStart(2,"0");//补零操作
          var r=(dt.getDate()).toString().padStart(2,"0");
          dt.getHours();
          dt.getMinutes();
          dt.getSeconds();
          return n+"-"+y+"-"+r;
        }
      }
    }
</script>

<style scoped>

</style>
